package com.hqyj.onlineExamination.modules.common.controller;


import com.hqyj.onlineExamination.modules.common.entity.Mail;
import com.hqyj.onlineExamination.modules.common.entity.ResultEntity;
import com.hqyj.onlineExamination.modules.common.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class MailController {

    @Autowired
    MailService mailService;

    //简单邮件
    @PostMapping(value = "/simpleMail",consumes = "application/json")
    public ResultEntity<Object> sendSimpleMail(@RequestBody Mail mail) {
        return mailService.sendSimpleMail(mail);
    }

    //复杂邮件
    @PostMapping(value = "/complexMail", consumes = "application/json")
    public ResultEntity<Object> sendComplexMail(@RequestBody Mail mail) {
        return mailService.sendComplexMail(mail);
    }

    //thymeleaf模板邮件
    @PostMapping(value = "/templateMail", consumes = "application/json")
    public ResultEntity<Object> sendTemplateMail(@RequestBody Mail mail) {
        return mailService.sendTemplateMail(mail);
    }
}
